/**
 * Created with IntelliJ IDEA.
 * Description:
 * User: 张宇田
 * Date: 2024-09-20
 * Time: 18:19
 */
import java.util.Scanner;

public class ATM {
    public static int allMoney = 1000;

    public static void meun(Scanner sc){
        System.out.print("输入取款金额：");
        int money =  sc.nextInt();
        System.out.println();
        if(money>allMoney){
            System.out.println("目前余额："+allMoney+ "无法满足您的取款需求！");
            return;
        }
        int remMonry = allMoney - money;
        allMoney = allMoney - money;
        System.out.print("剩余金额："+remMonry+"，是否继续（'1'：结束，'2'：继续）：");
        System.out.println();
    }
    public static void main(String[] args) {
        System.out.println("欢迎使用中国人民银行ATM取款机");
        Scanner sc = new Scanner(System.in);
        int input = 0;
        do{
            meun(sc);
            input = sc.nextInt();//判断取钱
            switch(input){
                case 1:
                    System.out.println("取款结束！");
                    break;
                case 2:
                    meun(sc);
                    break;


            }
        }while(input == 2);

    }
}